<style lang="less">

</style>

<template>
  <div>
    <el-radio class="radio" v-model="radio" :label="'111'+xxx">备选项</el-radio>
    <el-input v-model="xxx"></el-input>
    <el-button type="primary" @click="exp">导出数据</el-button>
    <el-button type="primary" @click="exp1">导出数据带头</el-button>
    <el-button type="primary" @click="exp2">导出文件名数据带头</el-button>
    <el-button type="primary" @click="exp3" :loading="loading">数据字典导出</el-button>
  </div>
</template>

<script>
  import { searchDictEntity } from '../../api/system/Dict';
  export default{
    data () {
      return {
        radio: null,
        xxx: null,
        loading: false
      };
    },
    methods: {
      exp () {
        console.log(this.radio);
      },
      exp1 () {
        this.$ue.downloadFile([['a', 'b']], ['列1', '列2']);
      },
      exp2 () {
        this.$ue.downloadFile([['a', 'b']], ['列1', '列2'], '文件');
      },
      exp3 () {
        this.loading = true;
        searchDictEntity({
          token: this.$store.state.token,
          filters: '',
          sorts: ''
        }).then((res) => {
          this.loading = false;
          this.$ue.downloadFile(res.data.detailModelList.map(item => [item.createDate, item.dictCode, item.dictVal, item.cnDictValname]),
            ['创建日期', '字典类型', '字典码', '字典值'], '数据字典');
        });
      }
    }
  };
</script>
